﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_form/Menu/dao_tao.master" AutoEventWireup="true" CodeFile="xet_duyet.aspx.cs" Inherits="App_form_Daotao_xet_duyet" %>

<%@ Register TagPrefix="Control" TagName="menu_phai" Src="~/App_ctr/Admin/menu_phai.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%">
        <div style="width: 20%; float: left;">
            <Control:menu_phai runat="server" ID="menuphai" />
        </div>
        <div style="width: 79.4%; float: right;">
            <div style="background-image: url(../../CSS/images/ui-bg_glass_75_e6e6e6_1x400.png); font-weight: bold; height: 30px; border: 1px solid #d3d3d3; margin-top: 4px; text-align: center; padding-top: 8px; text-transform: uppercase;">
                Phiếu báo điểm - Phân loại
            </div>
            <div style="margin-top: 2px;">
                <div style="display: table; margin: 0 auto; width: 100%; border: 1px solid #d3d3d3; font-size: 16px;">
                    <div id="ndung_ct" class="clearfix" style="padding: 5px;">
                        <div style="width: 100%; float: left; padding: 30px;">
                            <div style="width: 100%; height: 5px; float: left;"></div>
                            <div style="float: left; width: 8%;">
                                <label>
                                    Năm học  :
                                </label>
                            </div>
                            <div style="float: left; width: 16%">
                                <Lib:drop runat="server" ID="namhoc" DataTextField="TEN" DataValueField="MA" Width="150px" Height="22px"></Lib:drop>
                            </div>
                            <div style="float: left; width: 8%;">
                                <label>
                                    hệ ĐT  :
                                </label>
                            </div>
                            <div style="float: left; width: 21%">
                                <Lib:drop runat="server" ID="loaidt" DataTextField="TEN" DataValueField="ID" Width="196px" Height="22px" onClientChange="PDT_KHOA_LKE()"></Lib:drop>
                            </div>
                            <div style="float: left; width: 6%;">
                                <label>
                                    Học kỳ :
                                </label>
                            </div>
                            <div style="float: left; width: 22%">
                                <Lib:drop runat="server" ID="hocky" DataTextField="TEN" DataValueField="MA" Width="196px" Height="23px"></Lib:drop>
                            </div>
                            <div style="width: 100%; height: 5px; float: left;"></div>
                            <div style="float: left; width: 8%;">
                                <label>
                                    Khóa :
                                </label>
                            </div>
                            <div style="float: left; width: 16%">
                                <Lib:drop runat="server" ID="khoa" DataTextField="TEN" DataValueField="ID" Width="153px" Height="22px" onClientChange="PDT_KHOA_LOP()"></Lib:drop>
                            </div>
                            <div style="float: left; width: 8%;">
                                <label>
                                    Lớp:
                                </label>
                            </div>
                            <div style="float: left; width: 21%">
                                <Lib:drop runat="server" ID="lop" DataTextField="TEN" DataValueField="ID" Width="196px" Height="22px"></Lib:drop>
                            </div>
                            <div style="float: left; width: 40%">
                                <Lib:Button runat="server" ID="tim" Icon="FIND" Text="Tìm" Width="100px" onClientClick="P_TIM()"></Lib:Button>
                                <Lib:Button runat="server" ID="Inbang" Icon="EXCEL" Text="In" Width="100px" onClientClick="P_DUYET_EXCEL()"></Lib:Button>
                            </div>

                        </div>
                        <div style="width: 100%; float: left;">
                            <table class="tableHeader">
                                <tr>
                                    <td style="width: 79px; text-align: center;" rowspan="2">Mã sv</td>
                                    <td style="width: 195px; text-align: center;" rowspan="2">Tên</td>
                                    <td colspan="3" style="text-align: center;">Điểm trung bình học kỳ</td>
                                    <td style="width: 144px; text-align: center;" rowspan="2">Xếp loại</td>
                                    <td style="text-align: center;" colspan="2">Điểm rèn luyện</td>
                                    <td style="text-align: center; width: 5px;" rowspan="2"></td>
                                </tr>
                                <tr>
                                    <td style="width: 91px; text-align: center;">VH+AN</td>
                                    <td style="width: 92px; text-align: center;">CM</td>
                                    <td style="width: 96px; text-align: center;">TBHT</td>
                                    <td style="width: 95px; text-align: center;">Điểm</td>
                                    <td style="width: 138px; text-align: center;">Quy đổi</td>
                                </tr>
                            </table>
                            <Lib:gridView runat="server" ID="diem" Width="1020" Height="350" HidenHeader="true">
                                <Columns>
                                    <Lib:Column BaseColumn="MA_SV" Name="Mã sv" Width="90" />
                                    <Lib:Column BaseColumn="tensinhvien" Name="Tên" Width="200" />
                                    <Lib:Column BaseColumn="vh" Name="V.Hóa" Width="100" DataType="Number" />
                                    <Lib:Column BaseColumn="cn" Name="C.Môn" Width="100" DataType="Number" />
                                    <Lib:Column BaseColumn="tbht" Name="T.Bình" Width="100" DataType="Number" />
                                    <Lib:Column BaseColumn="xeploai" Name="X.loại" Width="150" DataType="String" />
                                    <Lib:Column BaseColumn="rl" Name="R.Luyện" Width="100" DataType="Number" />
                                    <Lib:Column BaseColumn="quydoi" Name="X.loại" Width="150" DataType="String" />
                                </Columns>
                                <Pager>
                                    <Lib:Pager PageSize="14" />
                                </Pager>
                            </Lib:gridView>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField ID="kthuoc" runat="server" Value="0,0" />
    <script>

        function PDT_KHOA_LKE() {
            try {
                ht_dt = $("#<%=loaidt.ClientID%>").val()
                wdt_ma.FDT_KHOA_LKE(ht_dt, P_KHOA_LKE_KQ, ErrorDb, ErrorTimeOut);
                return false;
            }

            catch (err) {
                ShowError(err);
            }
        }
        function P_KHOA_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var grid = GetGridByID("<%=khoa.ClientID%>");
            grid.dataBin(b_kq);
            PDT_KHOA_LOP();
            return false;
        }
        //KKHOA LOP
        function PDT_KHOA_LOP() {
            try {
                b_khoa = $("#<%=khoa.ClientID%>").val();
                if (Common.NVL(b_khoa, "") == "")
                    b_khoa = 0.0;
                wdt_ma.FDT_LOP_LKE(b_khoa, P_LOP_LKE_KQ, ErrorDb, ErrorTimeOut);
            }

            catch (err) {
                ShowError(err);
            }
        }
        function P_LOP_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var grid = GetDropByID("<%=lop.ClientID%>");
            grid.dataBin(b_kq);
            return false;
        }
        function P_TIM() {
            //Xep loai
            var nam_id = $("#<%=namhoc.ClientID%>").val(),
            b_hk_id = $("#<%=hocky.ClientID%>").val();
            b_lop_id = $("#<%=lop.ClientID%>").val();
            wdt_ma.FDT_DIEM_CN_LKE(nam_id, b_lop_id, b_hk_id, P_DIEM_CN_LKE_KQ, ErrorDb, ErrorTimeOut);
        }
        function P_DIEM_CN_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            GetGridByID("<%=diem.ClientID%>").dataBin(b_kq);
        }

        //EXCEL
        function P_DUYET_EXCEL() {
            var nam_id = $("#<%=namhoc.ClientID%>").val(), b_lop_id = $("#<%=lop.ClientID%>").val();
            var b_ten_nam = $("#<%=namhoc.ClientID%> option:selected").text(), b_ten_lop = $("#<%=lop.ClientID%> option:selected").text();

            var he = "";
            b_ten_nam = "Năm học " + b_ten_nam;
            wdt_ma.FDT_DIEM_CN_LKE_EXCEL(nam_id, b_lop_id, he, b_ten_lop, b_ten_nam, P_DIEM_CN_XECEL_KQ, ErrorDb, ErrorTimeOut);
        }
        function P_DIEM_CN_XECEL_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var tenf = '<%= this.ResolveUrl("~/Outputs/")%>';
            tenf = tenf + b_kq;
            window.location.assign(tenf);
            return false;
        }

        //đk mới
        function P_DK_MOI_NH() {
            var nam_id = $("#<=nam_chon.ClientID%>").val(), b_lop_id = $("#<%=lop.ClientID%>").val();
            var gridData = GetGridByID("<%=diem.ClientID%>").getData();
            var a_id_sv = new Array(), a_tt = new Array();
            for (var i = 0; i < gridData.length; i++) {
                if (gridData[i] != "") {
                    a_id_sv[i] = gridData[i].ID;
                    a_tt[i] = gridData[i].CHON;
                }
            }
            wdt_ma.FDT_DK_NAM_MOI_NH(nam_id, b_lop_id, a_id_sv, a_tt, P_DIEM_CN_KQ, ErrorDb, ErrorTimeOut);
            return false;
        }

        function P_DIEM_CN_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            Msg.Show("Thông báo", "Chuyển thành công", "info");
        }
    </script>
</asp:Content>

